1. Field of the Invention
Embodiments of the present invention generally relate to computer processors.
2. Description of the Related Art
Modern computer systems typically include a processor which may access a volatile memory and other memory devices such as a hard drive. For example, the hard drive may provide relatively slow access to larger amounts of information while the volatile memory may provide relatively fast access to smaller amounts of information. Thus, the volatile memory may be used to temporarily store and access a portion of the information stored on the hard drive. In order to further increase the speed with which memory is accessed, a portion of the information accessed by the processor may also be stored within a cache within the processor. The cache may be smaller than the volatile memory while providing relatively faster access to the information stored therein.
In order to allow a thread executed by the processor to access the large amount of information stored on the hard drive using the relatively smaller cache, the computer system may provide address translation to translate between an effective address used by the thread and a virtual address space. The virtual address space may be large enough to address the entire range of memory addresses in the computer system. The virtual address may in turn be translated to a real address in order to use the real address to access the processor cache.
In some cases, the processor may also be configured to execute multiple threads simultaneously (referred to as multithreading). Also, each thread may use different mappings between effective, virtual, and real addresses. For example, during execution of a first thread, the first thread may use a first virtual address to load information from the hard drive into a first real address within the processor cache. The processor may then begin executing a second thread. The second thread may use a second virtual address which maps to different information from the hard drive. In some cases, the second virtual address may also map to the same real address (the first real address) used by the first thread to store information in the processor cache.
Thus, when the second thread begins execution, the processor cache may appear to contain information corresponding to the second virtual address when, in fact, the information in the cache, previously fetched for the first thread, is incorrect and outdated (e.g., stale). Because the processor cache may contain incorrect information with respect to the second virtual address requested by the second thread, execution of the second thread using the incorrect information may result in an error.
Accordingly, what is needed is an improved method, computer-readable medium, and apparatus for executing threads in a computer system.